<?php

	namespace app\admin\validate;
	use think\Validate;

class Role extends Validate
{
	//当前验证规则
	protected $rule = [
		'role_name'  =>'require|unique:admin_role,role_name,role_id',
		'roledesc'  =>'require',
		'roleaccess'=>'require'
	];
	//验证提示信息
	protected $message = [
		'role_name'   =>[
			'require'=>'角色名不能为空',
			'unique' =>'角色名已存在'
		],
		'user'       =>'角色名不能为空',
		'roledesc'=>[
			'require'=>'描述不能为空',
		],
		'roleaccess' =>'权限至少选一个'
	];
	//add 新增   edit 修改
	protected $scene = [
		// 'add' => ['role_name','roledesc','roleaccess'],
		// 'edit'=>['role_name','roledesc','roleaccess']
	];
}